package com.pfsoft.grpcserver.controller;

import com.pfsoft.grpcserver.service.IFileOperatorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @author pengfei
 * @date 2022年07月12日 14:18
 * file upload or downLoad
 */
@Slf4j
@RestController
public class FileManagerController {
    public String upload(MultipartFile file) {
        try {
            InputStream inputStream = file.getInputStream();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return "";
    }

    @Autowired
    private IFileOperatorService fileOperatorService;

    @GetMapping("/generate")
    public String genaratorData(){
        fileOperatorService.generatorData(10000*1000);
        log.info("generator data complete");
        return "complete";
    }

}
